#ifndef __ABSTRACT_UNIT_H__
#define __ABSTRACT_UNIT_H__

#include <string>
#include <set>

using namespace std;


class AbstractUnit
{
public:
    AbstractUnit (float factorToBase, string unit) : factorToBase_m(factorToBase), unitName_m(unit){/*UnitSet.insert(*this);*/};
    AbstractUnit (float factorToBase) : factorToBase_m(factorToBase){/*UnitSet.insert(*this);*/};
    AbstractUnit (const AbstractUnit& unit) : factorToBase_m(unit.factorToBase_m), unitName_m(unit.unitName_m){/*UnitSet.insert(*this);*/};
    virtual ~AbstractUnit(){/*UnitSet.erase(*this);*/};
    float convertToBenchmark() const;

    AbstractUnit& operator=(const AbstractUnit& abstractUnitA);
    bool operator==(const AbstractUnit& abstractUnitA) const;
    friend bool operator< (const AbstractUnit& abstractUnitA, const AbstractUnit& abstractUnitB);
 
    friend ostream& operator<<(ostream& os, const AbstractUnit& unit);
	void formatThisUnit( ostream &os, float &remainingAmount) const;
	
    bool isSameUnitType(const AbstractUnit& unit) const;  //is the same Unit type


private:

    void toString( ostream &os, float &amountInThisUnit, float &remainingAmount) const;
	void stripUnit( float &amountInThisUnit, float &remainingAmount) const;
    float factorToBase_m;
    string unitName_m;
};

typedef AbstractUnit Unit;

#endif
